﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JXT.PrimaryKey.Batman.Log;
using JXT.PrimaryKey.Batman.Container;
using JXT.PrimaryKey.Batman.Language;
using JXT.PrimaryKey.Batman.Core.Infrastructure;

namespace JXT.PrimaryKey.Batman.Core.WcfService
{
    public abstract class ServiceAttributeBase : Attribute
    {
        protected IContainer ServiceContainer
        {
            get { return ContainerManager.Service; }
        }

        private static SupernovaContext _context;
        public static SupernovaContext Context
        {
            get
            {
                if (_context == null)
                {
                    _context = new SupernovaContext(
                        ContainerManager.Default.Resolve<ILanguage>());
                }
                return _context;
            }
        }

        private ILogger _logger;

        public ILogger Logger
        {
            get
            {
                if (_logger == null)
                {
                    _logger = ContainerManager.Default.Resolve<ILogger>();
                }
                return _logger;
            }
        }
    }
}
